/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Ventana.java
 *
 * Created on 31/03/2011, 09:09:48 AM
 */
package mantenimientopc.vista;

import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;

/**
 *
 * @author Fabricio
 */
public class Ventana extends javax.swing.JFrame {

    /** Creates new form Ventana */
    public Ventana() {
        initComponents();
        setLocationRelativeTo(null);
        jCheckBox1.addItemListener(myListener);
        jCheckBox2.addItemListener(myListener);
        jCheckBox3.addItemListener(myListener);
        jCheckBox4.addItemListener(myListener);
        jCheckBox5.addItemListener(myListener);
        jCheckBox6.addItemListener(myListener);
        jCheckBox7.addItemListener(myListener);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        panelProblemas = new javax.swing.JPanel();
        jCheckBox1 = new javax.swing.JCheckBox();
        jCheckBox2 = new javax.swing.JCheckBox();
        jCheckBox3 = new javax.swing.JCheckBox();
        jCheckBox4 = new javax.swing.JCheckBox();
        jCheckBox5 = new javax.swing.JCheckBox();
        jCheckBox6 = new javax.swing.JCheckBox();
        jCheckBox7 = new javax.swing.JCheckBox();
        jLabel1 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTextPane1 = new javax.swing.JTextPane();
        jButton1 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Sistema Experto - Mantenimiento de Computadoras");
        setBackground(new java.awt.Color(0, 0, 0));

        panelProblemas.setBackground(new java.awt.Color(153, 153, 153));
        panelProblemas.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Problemas", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(255, 255, 255))); // NOI18N
        panelProblemas.setForeground(new java.awt.Color(255, 255, 255));

        jCheckBox1.setText("Contínuo reinicio del equipo");

        jCheckBox2.setText("No carga nada la computadora al encenderla (pantalla negra)");

        jCheckBox3.setText("El equipo se bloquea con cualquier aplicación");

        jCheckBox4.setText("El equipo no se enciende");

        jCheckBox5.setText("El computador no arranca desde el disco duro");

        jCheckBox6.setText("El equipo se demora mucho realizando alguna tarea");

        jCheckBox7.setText("Un periférico no funciona de manera adecuada");

        javax.swing.GroupLayout panelProblemasLayout = new javax.swing.GroupLayout(panelProblemas);
        panelProblemas.setLayout(panelProblemasLayout);
        panelProblemasLayout.setHorizontalGroup(
            panelProblemasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelProblemasLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelProblemasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jCheckBox1)
                    .addComponent(jCheckBox2)
                    .addComponent(jCheckBox3)
                    .addComponent(jCheckBox4)
                    .addComponent(jCheckBox5)
                    .addComponent(jCheckBox6)
                    .addComponent(jCheckBox7))
                .addContainerGap(232, Short.MAX_VALUE))
        );
        panelProblemasLayout.setVerticalGroup(
            panelProblemasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelProblemasLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jCheckBox1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jCheckBox2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jCheckBox3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jCheckBox4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jCheckBox5)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jCheckBox6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jCheckBox7))
        );

        jLabel1.setText("Posible Diagnóstico:");

        jTextPane1.setFont(new java.awt.Font("Verdana", 2, 12)); // NOI18N
        jTextPane1.setText("No tiene ningún problema");
        jScrollPane3.setViewportView(jTextPane1);

        jButton1.setText("BORRAR TODOS");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(panelProblemas, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addGap(132, 132, 132)
                        .addComponent(jButton1))
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 569, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panelProblemas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton1))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(27, 27, 27)
                        .addComponent(jLabel1)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        jCheckBox1.setSelected(false);
        jCheckBox2.setSelected(false);
        jCheckBox3.setSelected(false);
        jCheckBox4.setSelected(false);
        jCheckBox5.setSelected(false);
        jCheckBox6.setSelected(false);
        jCheckBox7.setSelected(false);
        jTextPane1.setText("No tiene ningún problema");
    }//GEN-LAST:event_jButton1ActionPerformed

    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Ventana().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JCheckBox jCheckBox1;
    private javax.swing.JCheckBox jCheckBox2;
    private javax.swing.JCheckBox jCheckBox3;
    private javax.swing.JCheckBox jCheckBox4;
    private javax.swing.JCheckBox jCheckBox5;
    private javax.swing.JCheckBox jCheckBox6;
    private javax.swing.JCheckBox jCheckBox7;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTextPane jTextPane1;
    private javax.swing.JPanel panelProblemas;
    // End of variables declaration//GEN-END:variables
    CheckBoxListener myListener = new CheckBoxListener();

    class CheckBoxListener implements ItemListener {

        public void itemStateChanged(ItemEvent e) {

            if (jCheckBox1.isSelected() == false && jCheckBox2.isSelected() == false && jCheckBox3.isSelected() == false && jCheckBox4.isSelected() == false && jCheckBox5.isSelected() == false && jCheckBox6.isSelected() == false && jCheckBox7.isSelected() == false) {
                jTextPane1.setText("No hay ningún problema");
            }
//            Object source = e.getItemSelectable();
//            if (source == jCheckBox1) {
//                if (jCheckBox1.isSelected()) {
//                    jTextPane1.setText("Verificar funcionamiento del cooler del microprocesador, Pasar un antivirus, Revisar que no haya conflicto de software y hardware ");
//                }
//            } else if (source == jCheckBox2) {
//                if (jCheckBox2.isSelected()) {
//                    jTextPane1.setText("Problema en la placa de video o en las memorias");
//                }
//            } else if (source == jCheckBox3) {
//                if (jCheckBox3.isSelected()) {
//                    jTextPane1.setText("Sobrecalentamiento, Pasar un antivirus");
//                }
//            } else if (source == jCheckBox4) {
//                if (jCheckBox4.isSelected()) {
//                    jTextPane1.setText("Verificar el funcionamiento de la fuente de poder y del cable de poder");
//                }
//            } else if (source == jCheckBox5) {
//                if (jCheckBox5.isSelected()) {
//                    jTextPane1.setText("Verificar el estado del disco duro, Realizar un scan disk, Comprobar que no existan otros medios de almacenamiento, Comprobar que el BIOS esté marcada la opción de arrancar desde el disco duro");
//                }
//            } else if (source == jCheckBox6) {
//                if (jCheckBox6.isSelected()) {
//                    jTextPane1.setText("Considerar repotenciar equipo, Realizar un scan disk, Pasar un antivirus");
//                }
//            } else if (source == jCheckBox7) {
//                if (jCheckBox7.isSelected()) {
//                    jTextPane1.setText("Comprobar servicio del ISP, Revisar tarjeta de red, Revisar controladores de tarjeta de red");
//                }
//            }
            if (jCheckBox1.isSelected()) {
                jTextPane1.setText("Verificar funcionamiento del cooler del microprocesador, Pasar un antivirus, Revisar que no haya conflicto de software y hardware ");
            }
            if (jCheckBox2.isSelected()) {
                jTextPane1.setText("Problema en la placa de video o en las memorias");
            }
            if (jCheckBox3.isSelected()) {
                jTextPane1.setText("Sobrecalentamiento, Pasar un antivirus");
            }
            if (jCheckBox4.isSelected()) {
                jTextPane1.setText("Verificar el funcionamiento de la fuente de poder y del cable de poder");
            }
            if (jCheckBox5.isSelected()) {
                jTextPane1.setText("Verificar el estado del disco duro, Realizar un scan disk, Comprobar que no existan otros medios de almacenamiento, Comprobar que el BIOS esté marcada la opción de arrancar desde el disco duro");
            }
            if (jCheckBox6.isSelected()) {
                jTextPane1.setText("Considerar repotenciar equipo, Realizar un scan disk, Pasar un antivirus");
            }
            if (jCheckBox7.isSelected()) {
                jTextPane1.setText("Comprobar controladores del dispositivo");
            }
            if ((jCheckBox1.isSelected() && jCheckBox3.isSelected()) || (jCheckBox1.isSelected() && jCheckBox3.isSelected()&&jCheckBox6.isSelected())) {
                jTextPane1.setText("Problemas con memoria RAM, Pasar un antivirus");
            }
            if (jCheckBox2.isSelected() && jCheckBox5.isSelected()) {
                jTextPane1.setText("Problemas con disco duro, Pasar un antivirus");
            }
            if (jCheckBox3.isSelected() && jCheckBox7.isSelected()) {
                jTextPane1.setText("Revisar controladores");
            }

//            if (e.getStateChange() == ItemEvent.DESELECTED) //...make a note of it...
//            {
//                jTextPane1.setText("Ha deseleccionado una opción");
//            }

        }
    }
}
